package com.example.chatgpt.options;

import android.content.Context;

import androidx.annotation.NonNull;

import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.engine.cache.LruResourceCache;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
//使MyAppGlideModule成为Glide的配置类
public class MyAppGlideModule extends AppGlideModule {

    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        //通过builder来进行Glide的配置
        //配置图片缓存大小
        int memoryCacheSizeBytes = 1024 * 1024 * 20;//20MB大小
        builder.setMemoryCache(new LruResourceCache(memoryCacheSizeBytes));
    }
}
